<div class="folder">
  <div class="search">
  <label>Yhteyshenkilö haku</label>
  <%form_tag({:action => :search}, {:method => :get}) do%>
                    <%=text_field_tag  :query %>
                    <%=submit_tag "Hae", :name => ''%>
  <%end%>
</div>
<table>
  <tr>
    <th>
      Yhteyshenkilö
    </th>
    <th>
      Asiakas
    </th>
    <th>
      Puhelin
    </th>
    <th>
      Sähköposti
    </th>
  </tr>
  <%for contact in @contacts %>
    <tr>
      <td>
        <%=link_to contact.last_name + ", " + contact.first_name, :action => "show", :id => contact %>
      </td>
      <td>
        <ul class="contact_customers">
          <%contact.customers.each do |customer| %>
            <li><%=link_to customer.name, :controller => 'customers', :action => 'show', :id => customer %></li>
          <% end %>
        </ul>
      </td>
      <td>
        <%=h contact.phone %>
      </td>
      <td>
        <%=h contact.email%>
      </td>
    </tr>
  <%end %>
</table>
</div>